﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="JsonServer.Default" %>

<%@ Register assembly="System.Web.DataVisualization, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" namespace="System.Web.UI.DataVisualization.Charting" tagprefix="asp" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
</head>
<body>
    <form id="form1" runat="server">
     <asp:ScriptManager ID="ScriptManager1" runat="server">
        </asp:ScriptManager>
        <asp:UpdatePanel ID="UpdatePanel1" runat="server">
            <ContentTemplate>
                <asp:ObjectDataSource ID="ObjectDataSource1" runat="server" 
                    DeleteMethod="Delete" InsertMethod="Insert" 
                    OldValuesParameterFormatString="original_{0}" SelectMethod="GetDataByDay" 
                    TypeName="JsonServer.DataSetTableAdapters.PowerTableAdapter" 
                    UpdateMethod="Update">
                    <DeleteParameters>
                        <asp:Parameter Name="Original_Id" Type="Int32" />
                    </DeleteParameters>
                    <InsertParameters>
                        <asp:Parameter Name="Power" Type="Double" />
                        <asp:Parameter Name="CreateTime" Type="String" />
                    </InsertParameters>
                    <SelectParameters>
                        <asp:ControlParameter ControlID="TextBoxYear" Name="YEAR" PropertyName="Text" 
                            Type="String" />
                        <asp:ControlParameter ControlID="TextBoxMonth" Name="MONTH" PropertyName="Text" 
                            Type="String" />
                        <asp:ControlParameter ControlID="TextBoxDay" DefaultValue="null" Name="DAY" 
                            PropertyName="Text" Type="String" />
                    </SelectParameters>
                    <UpdateParameters>
                        <asp:Parameter Name="Power" Type="Double" />
                        <asp:Parameter Name="CreateTime" Type="String" />
                        <asp:Parameter Name="Original_Id" Type="Int32" />
                    </UpdateParameters>
                </asp:ObjectDataSource>
                <asp:ObjectDataSource ID="ObjectDataSource2" runat="server" 
                    DeleteMethod="Delete" InsertMethod="Insert" 
                    OldValuesParameterFormatString="original_{0}" SelectMethod="GetDataByMonth" 
                    TypeName="JsonServer.DataSetTableAdapters.PowerTableAdapter" 
                    UpdateMethod="Update">
                    <DeleteParameters>
                        <asp:Parameter Name="Original_Id" Type="Int32" />
                    </DeleteParameters>
                    <InsertParameters>
                        <asp:Parameter Name="Power" Type="Double" />
                        <asp:Parameter Name="CreateTime" Type="String" />
                    </InsertParameters>
                    <SelectParameters>
                        <asp:ControlParameter ControlID="TextBoxYear" Name="YEAR" PropertyName="Text" 
                            Type="String" />
                        <asp:ControlParameter ControlID="TextBoxMonth" Name="MONTH" PropertyName="Text" 
                            Type="String" />
                    </SelectParameters>
                    <UpdateParameters>
                        <asp:Parameter Name="Power" Type="Double" />
                        <asp:Parameter Name="CreateTime" Type="String" />
                        <asp:Parameter Name="Original_Id" Type="Int32" />
                    </UpdateParameters>
                </asp:ObjectDataSource>
                <asp:Chart ID="Chart1" runat="server" DataSourceID="ObjectDataSource1">
                    <series>
                        <asp:Series ChartType="Spline" Name="Series1" XValueMember="CreateTime" 
                            YValueMembers="Power">
                        </asp:Series>
                    </series>
                    <chartareas>
                        <asp:ChartArea Name="ChartArea1">
                        </asp:ChartArea>
                    </chartareas>
                </asp:Chart>
                <br />
                <asp:Chart ID="Chart2" runat="server" DataSourceID="ObjectDataSource2">
                    <series>
                        <asp:Series ChartType="Spline" Name="Series1" XValueMember="CreateTime" 
                            YValueMembers="Power">
                        </asp:Series>
                    </series>
                    <chartareas>
                        <asp:ChartArea Name="ChartArea1">
                        </asp:ChartArea>
                    </chartareas>
                </asp:Chart>
                <asp:GridView ID="GridView1" runat="server" AllowPaging="True" 
                    AllowSorting="True" AutoGenerateColumns="False" DataKeyNames="Id" 
                    DataSourceID="ObjectDataSource1">
                    <Columns>
                        <asp:BoundField DataField="Id" HeaderText="Id" InsertVisible="False" 
                            ReadOnly="True" SortExpression="Id" />
                        <asp:BoundField DataField="Power" HeaderText="Power" SortExpression="Power" />
                        <asp:BoundField DataField="CreateTime" HeaderText="CreateTime" 
                            SortExpression="CreateTime" />
                    </Columns>
                </asp:GridView>
                <br />
                <div style="z-index: 1; left: 257px; top: 94px; position: absolute; height: 100px; width: 104px; text-align: right">
                    <asp:Label ID="Label7" runat="server" Text="Year: "></asp:Label>
                    <br />
                    <br />
                    <asp:Label ID="Label8" runat="server" Text="Month: "></asp:Label>
                    <br />
                    <br />
                    <asp:Label ID="Label9" runat="server" Text="Day: "></asp:Label>
                </div>
                <div style="z-index: 1; left: 384px; top: 91px; position: absolute; height: 108px; width: 162px; text-align: center">
                    <asp:TextBox ID="TextBoxYear" runat="server" style="text-align: left"></asp:TextBox>
                    <br />
                    <br />
                    <asp:TextBox ID="TextBoxMonth" runat="server"></asp:TextBox>
                    <br />
                    <br />
                    <asp:TextBox ID="TextBoxDay" runat="server"></asp:TextBox>
                </div>
                <asp:GridView ID="GridView2" runat="server" AllowPaging="True" 
                    AllowSorting="True" AutoGenerateColumns="False" DataKeyNames="Id" 
                    DataSourceID="ObjectDataSource2">
                    <Columns>
                        <asp:BoundField DataField="Id" HeaderText="Id" InsertVisible="False" 
                            ReadOnly="True" SortExpression="Id" />
                        <asp:BoundField DataField="Power" HeaderText="Power" SortExpression="Power" />
                        <asp:BoundField DataField="CreateTime" HeaderText="CreateTime" 
                            SortExpression="CreateTime" />
                    </Columns>
                </asp:GridView>
                <br />
                <asp:Timer ID="Timer1" runat="server" Interval="5000" ontick="Timer1_Tick">
                </asp:Timer>
            </ContentTemplate>
        </asp:UpdatePanel>
    <div>
        <asp:UpdateProgress ID="UpdateProgress1" runat="server">
            <ProgressTemplate>
                Nowloading...
            </ProgressTemplate>
        </asp:UpdateProgress>
        </div>

    </form>
</body>
</html>
